#include <stdio.h>

int isPandigital(int n)
{
	int a[10]={0}, i;
	while(n) {
		a[n%10]++;
		if (a[n%10] != 1 || n%10 == 0)return 0;
		n /=10;
	}
	i = 1;
	while(i<10)if (a[i++] != 1)return 0;
	return 1;
}

int concate(int *a, int n)
{
	int r=a[0], i=1, t;
	while (i<n) {
		t = a[i];
		while(t) {
			t /= 10;
			r = r*10;
		}
		r +=a[i++];
	}	
	return r;
}

int main()
{
	int a[2], i;
	printf("%d\n", isPandigital(123456789));
	for (i=9876; i>9123; i--) {
		a[0] = i;
		a[1] = i*2;
		if (isPandigital(concate(a, 2))) {
			printf("%d %d\n", i, i*2);
			break;
		}
	}
	printf("%d\n", concate(a, 2));
}
